﻿@{
    Layout = null;
    ViewBag.Title = @ViewBag.SysTitle;
}
<!doctype html>
<html>
<head>
    <title>@ViewBag.SysTitle</title>
    <base id="pageBase" href='http://@Request.Url.Authority/' />
    <link href="/Content/styles/login_v1.css" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jQuery/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script src="/Scripts/jQuery/jquery.enplaceholder.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#UserName").blur(function () {
                var username = $("#UserName").val();
                if (username.length > 1) {
                    $.post("/Login/GetDutyByUsername", { userName: username }, function (json) {
                        if (json.statusCode == "200") {
                            if (json.data != null && json.data.length > 1) {
                                $("#trDuty").css("display", "");
                                var duty_Options = null;
                                duty_Options += "<option value='' >" + "--请选择岗位--" + "</option>";
                                for (var i = 0; i < json.data.length; i++) {
                                    duty_Options += "<option value=\"" + json.data[i].Code + "\" " + "dutyid=\"" + json.data[i].ID + "\"  >" + json.data
[i].Name + "</option>";
                                }
                                $("#duty_login").html(duty_Options);
                                //                                var dutyName = $("#duty_login").find("option:selected").text();
                                //                                $("#hidDutyName").val(dutyName);
                            }
                            else {
                                //不显示岗位选择
                                $("#trDuty").css("display", "none");
                            }
                        }
                    });
                }
            });

            $("#duty_login").bind("change", function () {
                var dutyName = $("#duty_login").find("option:selected").text();
                $("#hidDutyName").val(dutyName);
                var dutyID = $("#duty_login").find("option:selected").attr("dutyid");
                $("#hidDutyID").val(dutyID);
            });
            $("#Login_reset").bind("click", function () {
                $("#UserName").val("");
                $("#pwd").val("");
            });

            function checkEmptyText(obj, objVal, obj2, objval2) {
                var prjname = $("#" + obj).val();
                if (prjname == "" || prjname == objVal) {
                    $("#" + obj2).html(objval2);
                }
                $("#" + obj).focus(function () {
                    if ($(this).val() == objVal) {
                        $(this).val("");
                    } else {
                        $("#" + obj2).html("");
                    }
                }).blur(function () {
                    if ($(this).val().length == 0) {
                        if (obj == "pwd") {
                            $("#" + obj2).html(objVal);
                        } else {
                            $(this).val(objVal);
                        }
                    }
                });
                $("#" + obj2).click(function () {
                    $("#" + obj).focus();
                });
            }
        });
        //登录界面居中显示 2013-12-25 黄现伟
        function bodyH() {
            var b = $(".wrapH").height();
            var w = $(window).height();
            var p = (w - b) / 2 + "px";

            if (w > b) {
                $("body").css({ "padding-top": p });

            } else {
                $("body").css({ "padding-top": 0 });
            }
        }
        $(function () {
            bodyH();
            $('.loginFormTdIpt').placeholder({
                isUseSpan: true,
                placeholderColor: '#666',
                onInput: false
            });
        });
        $(window).resize(function () {
            bodyH();
        }); 
    </script>
</head>
<body>
    <div class="wrapH">
        <div id="tip-bar" class="tip-bar">
            您现在使用的浏览器版本过低，可能会导致部分图片和信息的缺失。请立即 <a href="//windows.microsoft.com/zh-cn/internet-explorer/download-ie"
                id="kie-setup-IE8" target="_blank" title="免费升级至IE8浏览器">免费升级</a> 或下载使用 <a href="//www.mozilla.org/en-US/firefox/all/#zh-CN"
                    id="kie-setup-Browser" target="_blank" title="火狐浏览器">火狐浏览器</a> ！</div>
        <div id="header">
            <div class="layout header-wrap cf">
                <div class="fn-left">
                    <a href="/Login/Index" title="@ViewBag.SysTitle" class="logo-text"><strong>@ViewBag.SysTitle</strong></a></div>
                <div class="fn-right global-toplink">
                </div>
            </div>
        </div>
        <div id="main-bg" class="main-con mod-skin">
            <div id="main-cnt" class="layout bgskin2" style="">
                <div class="login">
                    <div class="login-func">
                        <strong>用户登录</strong></div>
                    <div class="err_tips pa" id="errorMsg">
                        @if (TempData["msg"] != null)
                        {
                            @TempData["msg"]
                        }
                    </div>
                    <div class="loginForm">
                        @using (Html.BeginForm("ValidateUser", "Login", FormMethod.Post, new { @id = "loginForm" }))
                        {
                            <div class="loginiput pr">
                                <input type="text" maxlength="50" name="UserName" placeholder="请输入帐号" id="UserName"
                                    tabindex="1" value="" class="loginFormTdIpt userIcon" autocomplete="off" />
                            </div>
                            <div class="loginiput pr" id="trDuty" style="display: none">
                                <select id="duty_login" name="Duty">
                                </select>
                                <input type="hidden" id="hidDutyName" name="DutyName" value='' />
                                <input type="hidden" id="hidDutyID" name="DutyID" value='' />
                            </div>
                            <div class="loginiput pr">
                                <input type="password" name="pwd" id="pwd" title="请输入密码" tabindex="2" placeholder="请输入密码"
                                    class="loginFormTdIpt pwdIcon" value="" />
                            </div>
                            <div class="btn-login">
                                <input name="submit" type="submit" class="azure vm RA" value="登录" />
                                @*<input name="submit" type="reset" value="重置" />*@
                            </div>@*
                            <div class="loginHelp">
                                <a href="/Drivers/WebPlug-in.rar">下载驱动程序</a></div>
                            <div class="APPdownload">
                                <div>
                                    <img src="Content/images/login/APPdownload.png">
                                    <p>
                                        扫一扫<br />
                                        下载APP</p>
                                </div>
                            </div>*@
                        }
                        <div class="helpList">
                            @*<ul class="helpListUl">
                                <li><a href="#" onclick="autoLogin('tjht11');">计量员</a></li>
                                <li><a href="#" onclick="autoLogin('tjjl1');">项目经理</a></li>
                                <li><a href="#" onclick="autoLogin('htjl');">监理合同工程师</a></li>
                                <li><a href="#" onclick="autoLogin('zj1');">总监理工程师</a></li>
                                <li><a href="#" onclick="autoLogin('gchtc');">业主</a></li>
                                <li><a href="#" onclick="autoLogin('kingroad');">管理员</a></li>
                                <script type="text/javascript">
                                    function autoLogin(name, pwd) {
                                        if (!pwd) pwd = "123456";
                                        $('#UserName').val(name); $('#pwd').val('123456'); $('.btn-login input').click();
                                    }
                                </script>
                            </ul>*@
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="copyrights">@ViewBag.Copyright 版本：@ViewBag.VersionNumber
            <br />
            技术支持：<a href="@ViewBag.Href" target="dialog">@ViewBag.CompanyName</a> 联系电话：@ViewBag.Phone</div>
    </div>
    <script type="text/javascript">
        (function () {
            function IEMode() {
                var ua = navigator.userAgent.toLowerCase();
                var re_trident = /\btrident\/([0-9.]+)/;
                var re_msie = /\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/;
                var version;
                if (!re_msie.test(ua)) {
                    return false;
                }
                var m = re_trident.exec(ua);
                if (m) {
                    version = m[1].split(".");
                    version[0] = parseInt(version[0], 10) + 4;
                    version = version.join(".");
                } else {
                    m = re_msie.exec(ua);
                    version = m[1];
                }
                return parseFloat(version);
            }
            var ie = IEMode();
            if (ie && ie < 8 && (self.location.href.indexOf("_xbox=true") < 0)) {
                document.getElementById('tip-bar').style.display = 'block';
                document.getElementById('kie-setup-IE8').style.backgroundImage = 'url(../../Content/images/login/browser.png)';
                document.getElementById('kie-setup-Browser').style.backgroundImage = 'url(../../Content/images/login/browser.png)';
            }
        })();
    </script>
</body>
</html>
